Repository navigation
fix(linux): video decode on ARM drivers (V4L2-backed VA-API, Turnip) - #1470
TheWeaklessOne wants to merge 8 commits into
Conversation
Qualcomm iris behind the msm VA-API driver (SteamOS ARM, Odin 2 Portal) rejects contexts and surfaces below its 96x96 decoder minimum, so the 16x16 probe surface reported a working H.264 decoder as unavailable. Raise INITIAL_CONTEXT_SIZE to 128, which still covers radeonsi's 64x64 minimum, and size the probe surface from the same constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Turnip (Adreno 740) has no VIDEO_DECODE queue family. FFmpeg's Vulkan hwdevice setup fetched a queue that does not exist, and the gamescope WSI layer then aborted the whole application on the NULL VkQueue at startup. Reject such devices in SharedVulkanDevice::create and check for a decode queue before FfmpegDecoder touches Vulkan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…upport Turnip on the Adreno 740 has no G10X6_B10X6R10X6_2PLANE_420 and no R10X6 views, and an image of a format the driver cannot sample reads as zeros, so 10-bit HDR streams through VA-API DMA-BUF came out green. When the multi-planar format is not sampleable with the frame's DRM modifier, import the planes as R16 and R16G16 images over the same DMA-BUF, as libplacebo does. Drivers that support the multi-planar format keep the existing path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames After a decoder queue overflow the recovery keyframe replaces the stale decode work. queue_video_command reported that as DroppedOldest, so the caller kept keyframe_requested and video_desynced set, and every later overflow believed a request was already pending: the stream froze until an IDR happened to arrive. Report the queued keyframe as Queued, including at the overflow boundary, and request the keyframe again if none has come within 250 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… backlogs A picture the hardware failed to decode reached the session as a generic backend error. Map it to ReferenceLost, in decode and in DMA-BUF export. Overflow recovery reopened the decoder, which takes long enough for the queue to overflow again. Decoders that can flush in place now do that (FFmpeg VA-API: avcodec_flush_buffers). A backlog that does not drain only adds latency, so 12 or more encoded frames still queued after 250 ms are dropped and a keyframe is requested. The embedded Linux queue grows to 24 frames, 200 ms at 120 fps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MediaCodec and polled H.264 V4L2 can still hold output from before a stale backlog was dropped. Polling it cleared need_keyframe, so the deltas that follow were decoded without the frames just removed. Only a submitted frame opens the gate now; startup and recovery already pass a keyframe through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d frames The stale-backlog timer survived decoder recovery, so the first keyframe after a long recovery could be dropped right away with the backlog behind it. Clear it while waiting for a keyframe. QueueOverflow reported one frame for a whole dropped backlog. Carry the real count through to MediaFeedback::QueueDropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A queue overflow can put a keyframe with reset set and a newer generation behind the frames still being measured. Dropping every Decode removed that recovery too and forced another keyframe wait. Drop only the generation in progress, and skip the keyframe request when a recovery is already queued. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
On ARM drivers (an AYN Odin 2 Portal: Turnip on the Adreno 740, Qualcomm iris behind a V4L2-backed VA-API driver)
the Linux decode path breaks in five ways:
This folds #1410 and #1412-#1415 into one PR on today's
dev; I'll close those five with a link here.On the Portal: the streamer's tests pass, and a free-tier session decoded AV1 1080p over VA-API at 59.7-60.1 fps for
231 s. It had no stall, no dropped frame and no keyframe request.
Description
The commits, one problem each. Each original PR has the reasoning and the measurements from 2026-11-05:
INITIAL_CONTEXT_SIZEgoes to 128, which still covers radeonsi's 64x64 (#1301)VIDEO_DECODEqueue family; FFmpeg's Vulkan hwdevice fetched a NULL queue and the gamescope WSI layer aborted the appR16_UNORM+R16G16_UNORMover the same DMA-BUF when the 3-plane 10-bit format or its plane views are missing, as libplacebo doesDroppedOldest, so the latch never cleared; plus a 250 ms re-requestReferenceLostinstead of a dead decoder; an overflow no longer reopens the decoder; a stale backlog drops to liveHow it was tested
Device: AYN Odin 2 Portal (Snapdragon 8 Gen 2), SteamOS ARM (Zaviya 1.5), Mesa Turnip, the msm VA-API driver from
hashtagbasit/Zaviya#80 over iris. The build had these eight commits on
maina9de957. Rebased ontodev6355ed7,the files they touch are byte for byte the same, because
devchanges none of them sincemain. The build alsocarried #1417, since the device has Qt 6.8.0.
Tests on the device:
cargo test -p opennow-streamer-platform --features linux-vaapi,linux-ffmpeg-bundled: 212 passed, 0 failed.cargo test -p opennow-streamer-platform-linux --features vaapi,ffmpeg-bundled: 257 passed, 1 failed.cargo test -p opennow-streamer-platform-linux: 191 passed, 1 failed.session::tests::fixed_audio_output_never_falls_back_and_stays_isolated, which fails onthis device with "ALSA device enumeration failed: -2" under its own
ALSA_CONFIG_PATHfixture. This PR changes noaudio output code.
video_decode_requires_a_decode_queue_family,keyframe_at_the_overflow_boundary_reports_itself_queued,stale_backlog_drop_keeps_a_newer_generation_recovery,remove_where_keeps_the_other_items_in_order,linux_keyframe_retry_rearms_after_the_intervalandvaapi_picture_errors_are_recoverable_and_others_are_not. The last one needs thevaapifeature.Session: the free tier, a single-player game, launched from Steam in the gamescope session. NVST AV1 8-bit 4:2:0
1920x1080 (120 fps asked, the free rig sent 60), decoded through VA-API with
/dev/video0open. 231 s, 13,753 videoframes, 59.7-60.1 decoded fps in every 10 s window,
transportFrameProgressStalled=falsein 18 of 18 reports. Onekeyframe (the start IDR), 0 keyframe requests, 0 decode-error or recovery lines, 0 dropped frames. The session ended
with End session. The rig showed the game's first-run dialog the whole time, so the picture was static. No decode
error happened on its own, so the recovery commits were covered by their tests and by the 2026-11-05 runs in #1414
and #1415, not by this session.
Built and tested with help from Claude and Codex (AI assistants). The device and the runs are mine.